#!/usr/bin/python

# PyPanelConfig provides a GUI to facilitate the configuration of
# the lightweight panel/taskbar PyPanel.

# Copyright 2011 Nicholas Rempel
#
# This file is part of PyPanelConfig
#
# PyPanelConfig is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PyPanelConfig is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Comment the first line and uncomment the second before installing
# or making the tarball (alternatively, use project variables)
UI_FILE = "/home/nrempel/Programming/PyPanelConfig-0.1/pypanelconfig/pypanelconfig.ui"
#UI_FILE = "/usr/local/share/PyPanelConfig-0.1/pypanelconfig/pypanelconfig.ui"

import os
import sys

from gi.repository import Gtk, Gdk
exec(compile(open('/home/nrempel/pyptest').read(), 
    '/home/nrempel/pyptest', 'exec'))
    
class GUI:

    def __init__(self):

        self.builder = Gtk.Builder()
        self.builder.add_from_file(UI_FILE)
        self.builder.connect_signals(self)

        window = self.builder.get_object('main')
        window.show_all()
        
    def destroy(self, window):
        Gtk.main_quit()
        
    def on_close_clicked(self, button):
        Gtk.main_quit()
        
    # Getting the hang of some Gtk+ functions    
    def on_color_set(self, button):
        print(button.get_parent())
        print(button.get_child())
        print(button.get_name())
        print(button.get_title())
        print(button.get_color().red/256)
        print(int(button.get_color().red/256))
        print(hex(int(button.get_color().red/256)))

def main():
    app = GUI()
    Gtk.main()
    
if __name__ == "__main__":
    sys.exit(main())